package xyz.whiteblue.render;

import xyz.whiteblue.beetl.BeetlRenderFactory;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by WhiteBlue on 15/6/14.
 */
public class RenderFactory {
    private HttpServletRequest request;
    private HttpServletResponse response;

    public RenderFactory(HttpServletRequest request, HttpServletResponse response) {
        this.request = request;
        this.response = response;
    }

    public Render getBeetlRender(String view) {
        Render render = BeetlRenderFactory.getRender(view);
        render.setContext(request, response);
        return render;
    }

    public Render getErrorRender(int errorCode) {
        Render render = new ErrorRender(errorCode);
        render.setContext(request, response);
        return render;
    }

    public Render getRedirectRender(String url) {
        Render render = new RedirectRender(url);
        render.setContext(request, response);
        return render;
    }


}
